/**
 * Created with IntelliJ IDEA.
 * Description:旋转数组的最小数值
 * User: wangxin
 * Date: 2024-11-02
 * Time: 22:32
 */
public class test2 {
    public int minNumberInRotateArray (int[] nums) {
        // write code here
        int left = 0;
        int right = nums.length - 1;
        while(left <= right){
            int mid = (left + right) / 2;
            if(nums[mid] < nums[right]){
                right = mid ;
            }else if(nums[mid] > nums[right]){
                left = mid + 1;
            }else{
                right--;
            }
        }
        return nums[left];
    }
}
